package cn.itcast.bos.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.jca.context.BootstrapContextAware;
import org.springframework.stereotype.Controller;

import cn.itcast.bos.domain.Noticebill;
import cn.itcast.bos.domain.User;
import cn.itcast.bos.utils.BOSContext;
import cn.itcast.crm.domain.Customer;
import cn.itcast.crm.service.CustomerService;

@Controller
@Scope("prototype")
public class NoticebillAction extends BaseAction<Noticebill> {

	private String phone;
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@Resource
	private CustomerService customerService;
	public String findCustomerByPhone(){
		Customer customer = customerService.findCustomerByPhone(phone);
		this.writeObject2json(customer, new String[]{"decidezone_id"});
		return NONE;
	}
	
	//新单
	public String saveNoticebill(){
		User user = BOSContext.getLoginUser();
		model.setUser(user);
		noticebillService.save(model);
		return NONE;
	}
}
